#include <stdio.h>
#include <string.h>

struct bigint
{
	int data[20000];
	int dp;

	bigint ()
	{
		dp = 1;
		data[0] = 0;
	}

	bigint (int x)
	{
		dp = 0;
		while (x)
		{
			data[dp ++] = x % 10;
			x /= 10;
		}
		if (!dp)
			data[ dp ++] = 0;
	}

	void operator *= (int x)
	{
//		printf("mul %d\n", x);
		if (x == 0)
		{
			dp = 1;
			data[0]  = 0;
			return;
		}

		int j = 0;
		for (int i = 0; i < dp; i ++)
		{
			j += data[i] * x;
			data[i] = j % 10;
			j /= 10;
		}
		while (j > 0)
		{
			data[dp ++] = j % 10;
			j /= 10;
		}
	}

	void operator += (bigint& a)
	{
		int j, m = dp > a.dp? dp : a.dp;

		j = 0;
		for (int i = 0; i < m; i ++)
		{
			if (i < dp)
				j += data[i];
			if (i < a.dp)
				j += a.data[i];
			data[i] = j % 10;
			j /= 10;
		}
		dp = m;
		while (j > 0)
		{
			data[dp ++] = j % 10;
			j /= 10;
		}
	}

	void dump ()
	{
		for (int i = dp - 1; i >= 0; i --)
			printf("%d", data[i]);
		printf("\n");
	}
} ans, ans2;

char buf[20000];
char buff[20000];
int n;

inline int digitAt (int x)
{
	return x < 0? 0 : buf[x] - '0';
}

inline int getFactor (int total, bool first)
{
//	printf("getFactor %d %d\n", total, first);
	int re = 0;
	for (int i = (first? 1 : 0); i <= 9; i ++)
		re += (total - i >= 0 && total - i <= 9);
	return re;
}

int dec (int l, int r)
{
	if (l == r && buf[r] == '0')
		return false;
	if (buf[r] == '0')
	{
		buf[r] = '9';
		return dec(l, r - 1);
	}
	else
	{
		buf[r] --;
		return true;
	}
}

void getans (int l, int r, bool first)
{
	if (l == r + 1)
	{
		int total = digitAt(l - 1) * 10 + digitAt(l);
		ans *= (total == 0);
		return;
	}
	if (l == r)
	{
		int total = digitAt(l - 1) * 10 + digitAt(l);
		ans *= first? (total >= 2 && total <= 18 && total % 2 == 0) : (total >= 0 && total <= 18 && total % 2 == 0);
		return;
	}

	int total = digitAt(l - 1) * 10 + digitAt(l);
	int right = digitAt(r);

	if (total - right >= 0 && total - right <= 1)
	{
		buf[l] = total - right + '0';
		buf[r] = '0';
		ans *= getFactor(right, first);
		getans(l + 1, r - 1, false);
	}
	else if (total - right - 10 >= 0 && total - right - 10 <= 1)
	{
		buf[l] = total - right - 10 + '0';
		buf[r] = '0';
		if (dec(l - 1, r - 1))
		{
			ans *= getFactor(right + 10, first);
			getans(l + 1, r - 1, false);
		}
	}
	else
	{
		ans *= 0;
	}
}

int main () 
{
	while (scanf("%s", buf) > 0 && (buf[0] != '0' || buf[1] != 0))
	{
		n = strlen(buf);

		if (buf[0] == '1')
		{
			strcpy(buff, buf);
			ans = 1;
			getans(0, n - 1, true);
			ans2 = ans;
			strcpy(buf, buff);
			ans = 1;
			getans(1, n - 1, true);
			ans += ans2;
		}
		else
		{
			ans = 1;
			getans(0, n - 1, true);
		}

		ans.dump();
	}

	return 0;
}